package indi.defoliation.unknownrpg.api.rpgevent.entity;

import org.bukkit.entity.Entity;

import indi.defoliation.unknownrpg.api.attribute.Attribute;
import indi.defoliation.unknownrpg.api.rpgevent.Cancellable;

public class EntityMagicAttackEvent extends EntityEvent implements Cancellable{
	
	private Entity victim;
	private Double damage;
	private Attribute magicAttribute;
	private boolean cancel =false;

	public EntityMagicAttackEvent(Entity what,Entity victim,Attribute magicAttribute,Double damage) {
		super(what);
		this.victim=victim;
		this.damage=damage;
		this.magicAttribute=magicAttribute;
	}
	
	public Entity getVictim() {
		return this.victim;
	}
	
	public Double getDamage() {
		return this.damage;
	}
	
	public Attribute getMagicAttribute() {
		return this.magicAttribute;
	}
	
	public void setDamage(Attribute operator,double damage) {
		this.damage=damage;
		super.putLog(operator, this.clone());
	}
	
	@Override
	public boolean isCancelled() {
		return cancel;
	}

	@Override
	public void setCancelled(Attribute operoter, boolean cance) {
		if(this.cancel==cance)
			return;
		this.cancel=cance;
		super.getTable().addAction(operoter, super.clone());
	}

}
